﻿using System;
using Game.Common;
using Game.Map.Internal;

namespace Game.Map
{
    public static class MapViewFactory
    {
        public static event EventHandler<MapViewFactoryEventArgs> SetupView;

        public static IGameMapView CreateView(
            IGameMap map, 
            GamePlayer player)
        {
            return new GameMapView(map, player);
        }

        internal static void FireSetupView(
            IGameMapView view)
        {
            if (SetupView != null)
            {
                SetupView(view, new MapViewFactoryEventArgs(view));
            }
        }

    }

    public class MapViewFactoryEventArgs : EventArgs
    {
        readonly IGameMapView _View;

        public MapViewFactoryEventArgs(IGameMapView view)
        {
            _View = view;
        }

        public IGameMapView View
        {
            get { return _View; }
        }

    }
}
